#ifndef common_typedef_h
#define common_typedef_h

#include <cstdint>

namespace cmn{
#	define chr_cr			10
#	define chr_lf			13
#	define chr_eof			26
#	define BOM				0xfeff;

	typedef int8_t		int8;
	typedef int16_t		int16;
	typedef int32_t		int32;
	typedef int64_t		int64;

	typedef uint8_t		uint8;
	typedef uint16_t	uint16;
	typedef uint32_t	uint32;
	typedef uint64_t	uint64;

	typedef int8		byte;
	typedef int16		word;
	typedef int32		dword;
	typedef int64		qword;

	typedef char*		cstr;
	typedef wchar_t*	cwstr;

	typedef const int8		kbyte;
	typedef const int16		kword;
	typedef const int32		kdword;
	typedef const int64		kqword;
	typedef const char*		kcstr;
	typedef const wchar_t*	kcwstr;

	template<class pointer>	inline void safe_release(pointer& obj)	{ if (obj) { obj->release(); obj = nullptr; } }
	template<class pointer>	inline void safe_delete(pointer& ptr)	{ if (ptr) { delete ptr;	ptr = nullptr; } }
	template<class array>	inline void safe_delete_arr(array& arr)	{ if (arr) { delete[] arr;	arr = nullptr; } }
}

#endif	//common_typedef_h
